auth: add DATABRICKS_DISCOVERY_HOST env var to override login.databricks.com#5283
Merged
Conversation
…cks.com The discovery login flow (databricks auth login without --host) opens https://login.databricks.com. The SDK already supports overriding that host via u2m.WithDiscoveryHost; this wires the option to a new DATABRICKS_DISCOVERY_HOST environment variable so developers can point the flow at a non-production login instance for testing. The browser-open log line also reflects the override host so the user can tell which host is being opened.
mihaimitrea-db
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The discovery login flow (
databricks auth loginwithout--host) openshttps://login.databricks.com. That host is hardcoded in the CLI, so there is no way to point the flow at a non-production login instance during testing or development.The SDK already exposes
u2m.WithDiscoveryHost(added in databricks-sdk-go #1640, on the CLI's pinned v0.132.0). This PR wires it up.Changes
Before: No way to override the discovery host.
databricks auth loginalways openshttps://login.databricks.com.Now: If
DATABRICKS_DISCOVERY_HOSTis set, the CLI passes it through tou2m.WithDiscoveryHost(...). When unset, behavior is identical to before. The "Opening ... in your browser..." log line reflects the override host so it's clear which host is being opened.Intended for testing and development against non-production login instances; unset for normal use.
Test plan
TestDiscoveryLogin_OverridesHostFromEnvconfirms the env var is read and the log message reflects the override hostgo test ./cmd/auth/...passes./task checkspasses./task lint-qpasses